
cmake_minimum_required(VERSION 3.22)

project(lurpc_test VERSION 1.0.0)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED true)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

file(GLOB test_files "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")

function(get_pure_filename in_filename filename)
    string(FIND ${in_filename} "." dot_index REVERSE)
    if(${dot_index} EQUAL -1)
        set(${filename} ${in_filename})
    else()
        string(SUBSTRING ${in_filename} 0 ${dot_index} out_name)
        set(${filename} ${out_name} PARENT_SCOPE)
    endif()
endfunction()

foreach(test_file ${test_files})
    get_filename_component(name ${test_file} NAME)
    get_pure_filename(${name} pure_name)
    add_executable(${pure_name} ${test_file})
endforeach()
